<?php

class Pictures_Image_ListSuccessView extends BlogPicturesBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd, 'blog');
		/* @var $model Pictures_PicturesModel */
		$model = $this->getContext()->getModel('Pictures', 'Pictures');
		$ro = $this->getContext()->getRouting();
		
		$pictures = array();
		/* @var $picture Picture */
		foreach ($model->findPictures() as $picture) {
		    $pictures[] = array(
		        'name' => $picture->name, 
		        'view_url' => $ro->gen('pic.display', array('pic_name'=>$picture->name)),
		        'edit_url' => $ro->gen('pic.edit', array('pic_id'=>$picture->id)),
		        'delete_url' => $ro->gen('pic.delete', array('pic_id'=>$picture->id)),
		        'small_preview_url' => $ro->gen('pic.preview', array('size'=>'small','pic_name'=>$picture->name)),
		        'medium_preview_url' => $ro->gen('pic.preview', array('size'=>'medium','pic_name'=>$picture->name))
		    );
		}
		$this->setAttribute('pictures', $pictures);
		$this->setAttribute('title', 'Pictures list');
	}
}

?>
